<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body {
            width: 50%;
            height: 100vh;
            margin: 0 auto;
            display: flex;
            justify-content: flex-start;
            align-items: center;
            flex-wrap: wrap;
        }

        hr {
            background-color: red;
            height: 1px;
            border: 0;
        }

        body>div {
            height: 250px;
            width: 250px;
            margin: 5px;
        }

        .div1 {
            background-color: black;
            color: red;
        }

        .div2 {
            background-color: rgb(0, 0, 0);
            color: rgb(255, 0, 0);
        }

        .div3 {
            background-color: rgba(255, 0, 0, 0.5);
            color: #bfc;
        }

        .div4 {
            background-color: #233333;
            color: #abefe9;
        }
    </style>
</head>

<body>
    <div class="div1">
        background-color:black;
        <br>
        color:red;
        <hr>
        颜色可通过引文单词进行设定。具体可参考W3C手册
    </div>
    <div class="div2">
        background-color:rgb(0,0,0);
        <br>
        color:rgb(255,0,0);
        <hr>
        通过rgb值设定颜色,rgb(red,green,blue)[0-255 0%-100%]
    </div>
    <div class="div3">
        background-color: rgba(255,0,0,0.5);
        <br>
        color:#bfc;
        <hr>
        第四个值为透明度，取值0-1
    </div>
    <div class="div4">
        background-color: #233333;
        <br>
        color: #abcdef;
        <hr>
        颜色也可通过十六进制表示，格式为 #[00-ff][00-ff][00-ff]
        <br>两两重复的颜色可以简写，如#ff0000->#f00,#aabbcc->#abc
    </div>


</body>

</html>